<?php

session_start();

echo "Uploaded:\n";
$contacts = $_FILES['contacts-upload'];
$file = $contacts['tmp_name'];
$descriptor = fopen ($file, "r"); 
$contents = fread ($descriptor, filesize ($file)); 
fclose ($descriptor); 

$nl = "\n";
$lines = split($nl,$contents);

//echo "Count: "+count($lines)."\n\n";
//$rows = array();
for ($i=1;$i < count($lines);$i++) 
{
	list($first,$nick,$middle,$last,$title,$company,$office,$mobile) = split(',', $lines[$i], 8);
	echo "Last=".$last.", First=".$first."\n";	
	//echo $lines[$i]."\n";
}

?>
